New Markup Elements and Attributes

The primary task of HTML is to describe the structure of a Web page, with the help of elements and attributes. In this new version of HTML, some elements and attributes of the previous version are deleted and some new elements and attributes introduced in HTML 5. The purpose of introduction of new elements and attributes in HTML 5 is:

  • Better structure of a Web page
  • Better presentation of drawings and pictures on a Web page
  • Better handling of media content
  • Better form handling of an HTML Web page

The important markup elements introduced in HTML 5 are:

  • <convas>: Helps in adding images, graphs, or tooltips on a Web page
  • <video>: Helps in adding video on a Web page
  • <audio>: Helps in adding audio on a Web page

Similarly, new attributes are also introduced in HTML 5 input element, for better control over the input value before the value is send to the server.

New form Elements and Attributes

The new form elements and attributes introduced in HTML 5 replace the need for tedious scripting and styling that was earlier required in HTML 4. The Web pages that are created using HTML 5 are consistent across different Web browsers by providing a greater degree of semantic markup. The new form elements and attributes proved the following features:

  • Auto Focus: Provides the focus on the input field automatically whenever the Web page is loaded. You can set the focus on the input field of a Web form by using the autofocus attribute.
  • Date and Time: Refers to new input type value as datetime, which helps in displaying the global date and time on a Web page. To display date and time, you can use this tag as <input type=”datetime”>.
  • URL and Email: Refers to the URL and Email values that are specified in the type attribute of an input element. Both these values logically define the type of data that the user needs to enter. For example, <input type=”url”> tag specifies that user should enter only the address of a website and another <input type=”email”> tag specifies that only email id should be entered in other words, it validates the field of url and email.
  • Slider Creation: Refers to adding the functionality of a slider control by defining the <input type=”range” /> tag. The slider control is similar to the spinbox control.
  • Uploading Multiple Files: Facilitates the uploading of multiple files by using <input type=”file” multiple> tag in a Web form. This feature currently works only in the Safary Web browser.